---回复生命
---@class BuffEffect7 : BaseBuffEffect
BuffEffect7 = ClientFight.CreateClass("BuffEffect7", ClientFight.BaseBuffEffect)
local t = BuffEffect7

---@param fight Fight
---@param buff FighterBuff
function t:action(fight, buff, ...)
    local parameters = { ... }
    if (self:isDamageActionTrigger(buff))then
        local isBuff = parameters[4];
        if (isBuff) then
            return IBuffEffect.FAIL;
        end
    end
    if(buff.target:isDie()) then
        --伤害后已经死亡的不加血
        return IBuffEffect.FAIL;
    end
    if (FighterStateEnum.is(buff.target,FighterStateEnum.BAN_HEAL)) then
        return IBuffEffect.FAIL;
    end
    local bonus = buff.buffBean.f_BuffEffectValue[1] * buff.overlay
    local calculatorType = buff.buffBean.f_BuffEffectValue[2]
    local calculateAttrType = buff.buffBean.f_BuffEffectValue[3];
    local modifiedRatio = buff.buffBean.f_BuffEffectValue[4] * buff.overlay
    local calculator = calculatorType == 0 and buff.source or buff.target

    local result = FightResult.New();
    result:setState(DamageResultTypeEnum.HEAL);
    result:setDamage(AttackUtils.calculateEffectHeal(buff, calculator, calculateAttrType, modifiedRatio, bonus));
    DamageManager.realDamage(fight, buff.source, buff.target, buff.modelId, result, SkillDamageTypeEnum.HEAL);

    SkillRoleMgr.savePathFile( "[" .. fight.frame .. "][EFFECT]Fighter " .. buff.target.fighterId .. " Buff" .. buff.modelId .. " 触发回复HP效果，增加HP：" .. result.damage);

    return ClientFight.BaseBuffEffect.action(self,fight, buff, parameters);
end

t.New()